import { findTypeByValue, findTypeByLabel } from '@/utils/findType'
import * as types from "../question/types"
import { trainTaskStatus } from "./types"


// 渠道Table
export const configTableFrame = [
  { 
    prop: "num", 
    label: "序号", 
    minWidth: "50px", 
    tooltip: true 
  },
  { 
    prop: "name", 
    label: "任务名称", 
    minWidth: "150px"
  },
  { 
    prop: "status", 
    label: "任务状态", 
    minWidth: "100px",
    formatter: (row) => {
      return findTypeByValue(row.status, trainTaskStatus)
    }
  },
  { 
    prop: "projectName", 
    label: "项目",
    minWidth: "100px"
  },
  {
    prop: "questionVo",
    label: "题目",
    minWidth: "100px",
    formatter: (row) => {
      if(row && row.questionVo && row.questionVo.title){
        return row?.questionVo?.title
      }

      return ''
    }
  },
  {
    prop: "questionType",
    label: "题目类型",
    minWidth: "100px",
    formatter: (row) => {
      if(row && row.questionVo && row.questionVo.type){
        return findTypeByValue(row.questionVo.type, types.questionType)
      }
      return ''
    }
  },
  {
    prop: "shared",
    label: "允许分享",
    minWidth: "100px",
    formatter: (row) => {
      if(row && row.shared && row.shared){
        return findTypeByValue(row.shared, types.sharedType)
      }
      return ''
    }
  },
  
  {
    prop: "trainDoctor",
    label: "训练者",
    minWidth: "100px",
    formatter: (row) => {
      if(row && row.trainUser && row.trainUser.name){
        return row?.trainUser?.name
      }
      return ''
    }
  },
  {
    prop: "reviewDoctor",
    label: "审核者",
    minWidth: "100px",
    formatter: (row) => {
      if(row && row.reviewUser && row.reviewUser.name){
        return row?.reviewUser?.name
      }
      return ''
    }
  },
  {
    prop: "reviewRemark",
    label: "审核意见",
    minWidth: "100px"
  },
  { 
    label: "操作", 
    slotName: "operate", 
    fixed: "right",
    minWidth: "120px"
  },
];


export const searchFrame = [
  { 
    label: "任务名称", 
    key: "name", 
    type: 1
  },
  {
    label: "项目",
    key: "projectId",
    type: 2,
    options: []
  },
  {
    label: "问题类型",
    key: "questionType",
    type: 2,
    options: [{
      label: "问答",
      value: "0"
    },{
      label: "视频解读",
      value: "1"
    },{
      label: "案例",
      value: "2"
    }]
  },
  {
    label: "任务状态",
    key: "status",
    type: 2,
    options: [{
      label: "未完成",
      value: "0"
    },{
      label: "已完成",
      value: "1"
    },{
      label: "审核通过",
      value: "2"
    },{
      label: "被驳回",
      value: "3"
    }]
  }
]
